package com.study.lintcode.my.code_10;

import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

/**********************************************************************
 * &lt;p&gt;文件名：Example_1.java &lt;/p&gt;
 * &lt;p&gt;文件描述：(https://www.lintcode.com/problem/a-b-problem/)
 * @project_name：LintCode
 * @author zengshunyao
 * @create 2019/1/5 21:56
 * @history
 * @department：政务事业部
 * Copyright ChengDu Funi Cloud Code Technology Development CO.,LTD 2014
 *                    All Rights Reserved.
 */
public class Example_9 {
    /**
     * @param n: An integer
     * @return: A list of strings.
     */
    public List<String> fizzBuzz(int n) {
        // write your code here
        List<String> list = new LinkedList<String>();
        Integer i = new Integer(0);
        while (++i <= n) {
            if (i % 15 == 0) {
                list.add("fizz buzz");
                continue;
            }
            if (i % 5 == 0) {
                list.add("buzz");
                continue;
            }
            if (i % 3 == 0) {
                list.add("fizz");
                continue;
            }
            list.add(i.toString());
        }
        return list;
    }


    public static void main(String[] args) {
        System.out.println(Arrays.toString(new Example_9().fizzBuzz(15).toArray()));
    }
}
